package com.yc.sole.erp.request;

import com.yc.sole.framework.validate.SaveGroup;
import com.yc.sole.framework.validate.UpdateGroup;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Request对象
 *
 * @author yizuomin
 * @date 2023-12-15
 **/
@Data
public class ProductReq implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @NotNull(groups = {UpdateGroup.class})
    private Long id;
    /**
     * 模具id
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Long moldId;
    /**
     * 产品名称
     */
    @Length(max = 50, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String productName;
    /**
     * 含税单价
     */
    @DecimalMax(value = "99999999", groups = {SaveGroup.class, UpdateGroup.class})
    @DecimalMin(value = "0.01", groups = {SaveGroup.class, UpdateGroup.class})
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private BigDecimal unitPrice;
    /**
     * 单位
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String unit;
    /**
     * 类别id
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Long categoryId;
    /**
     * 重量
     */
    @Min(value = 1, groups = {SaveGroup.class, UpdateGroup.class})
    private Integer weight;
    /**
     * 颜色
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String color;
    /**
     * 材质
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String material;
    /**
     * 尺码
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String size;
    /**
     * 长度
     */
    @Length(max = 20, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String length;
    /**
     * 库存数量
     */
    @Min(value = 1, groups = {SaveGroup.class, UpdateGroup.class})
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Integer stock;
}
